package com.ssy.lingxi.platform.template.service.controller.mobile;

import com.ssy.lingxi.common.controller.BaseController;
import com.ssy.lingxi.common.response.Wrapper;
import com.ssy.lingxi.platform.template.service.model.dto.common.IdDTO;
import com.ssy.lingxi.platform.template.service.model.dto.common.MemberIdAndRoleIdDTO;
import com.ssy.lingxi.platform.template.service.model.dto.mobile.ChannelMemberCategoryMobileDTO;
import com.ssy.lingxi.platform.template.service.model.vo.mobile.MobileCategoryVO;
import com.ssy.lingxi.platform.template.service.service.mobile.CategoryMobileService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.validation.Valid;
import java.util.List;

/**
 *  mobile - 品类
 * @author fhj
 * @version 2.0.0
 * @date 2021/09/02
 */
@Api(tags = "mobile - 品类")
@RestController
@RequestMapping("/template/mobile/categoryMobile")
public class CategoryMobileController extends BaseController {

    @Resource
    private CategoryMobileService categoryMobileService;

    @ApiOperation(value = "APP企业商城首页（B端、C端）平台品类")
    @GetMapping("/enterpriseCategory")
    public Wrapper<List<MobileCategoryVO>> enterpriseCategory(@Valid IdDTO dto) {
        return categoryMobileService.enterpriseCategory(dto);
    }

    @ApiOperation(value = "校验平台品类是否存在于品类导航页")
    @GetMapping("/checkCategory")
    public Wrapper<Boolean> checkCategory(Long templateId, Long categoryId) {
        return categoryMobileService.checkCategory(templateId, categoryId);
    }

    @ApiOperation(value = "APP渠道商城首页会员品类")
    @GetMapping("/channelMemberCategory")
    public Wrapper<List<MobileCategoryVO>> channelMemberCategory(@Valid ChannelMemberCategoryMobileDTO dto) {
        return categoryMobileService.channelMemberCategory(dto, getSysUser());
    }

    @ApiOperation(value = "APP自营商城首页会员品类")
    @GetMapping("/selfMemberCategory")
    public Wrapper<List<MobileCategoryVO>> selfMemberCategory(@Valid IdDTO dto, @Valid MemberIdAndRoleIdDTO midAndRId) {
        return categoryMobileService.selfMemberCategory(dto, midAndRId);
    }
}
